/*
 * dnsClientPrototypes.h
 *
 *  Created on: Oct 8, 2009
 *      Author: Brad Lajoie and Adam Blackwell
 */

#ifndef DNSCLIENTPROTOTYPES_H_
#define DNSCLIENTPROTOTYPES_H_

void initializeQueryStruct(struct Query *myQuery);
void zeroMemory(void * ptr, size_t size);

void printUsageAndExit();
void printOutARecordResponse(struct Response myResponse);
void printOutCNAMEResponse(struct Response myResponse);

void urlToQname(char* theUrl, struct Query* myQuery);
void errorCheckResponse(struct Response myResponse, struct Query myQuery);

void serializeHeader(unsigned short* head, struct Header header);
void serializeQuestion(unsigned short* quest, struct Question question, int questionSize, int qnameSize);

void deserializePacket(struct Response* response, unsigned char* packet, int questionSize, int qnameSize);
void deserializeHeader(struct Header* header, unsigned short* head);
void deserializeQuestion(struct Question* question, unsigned char* quest, int questionSize, int qnameSize);
void deserializeAnswer(struct Answer* answer, unsigned char* answ, unsigned char* pack, int qnameSize);
char* deserializeName(unsigned char* readStartPosition, unsigned char* firstByte, unsigned char* pack);
unsigned short calculateAnswNameSize(unsigned char* answer);

#endif /* DNSCLIENTPROTOTYPES_H_ */
